import unittest
import ddt
from Base.BaseSetings import *
from Business.ClassManagement_wxj import cls_management

@ddt.ddt
class Cls_manage(unittest.TestCase):

    # @classmethod
    # def setUpClass(cls) -> None:
    #     print('dfghj')
    #     cls.run = cls_management()

    def setUp(self) -> None:
        self.run = cls_management()

    @ddt.file_data(TestData_dir + "stu_leave_select_wxj.yaml")
    def test_stu_leave_select(self,**kwargs):   #学员请假信息查询
        info=self.run.stu_leave_select(kwargs.get('region'),kwargs.get('status_leave'),kwargs.get('leave_stu_name'))
        # print(info)
        self.assertEqual(info[0][0],kwargs.get('leave_stu_name'))
        self.assertEqual(info[0][9],kwargs.get('status_leave'))
        self.assertEqual(info[0][8],kwargs.get('status_leave'))  #改错

    @ddt.file_data(TestData_dir + "stu_change_wxj.yaml")
    def test_stu_change(self,**kwargs):    #学员转班
        info=self.run.stu_change(kwargs.get('school_region'),kwargs.get('change_cls'))
        # print(info)
        self.assertEqual(info,kwargs.get('except'))

    @ddt.file_data(TestData_dir + "stu_change_wxj.yaml")
    def test_stu_change_query(self,**kwargs):   #学员转班信息查询
        infos=self.run.stu_change_query(kwargs.get('school_region'),kwargs.get('change_cls'))
        for info in infos:
            # print(info)
           self.assertEqual(info[3],kwargs.get('change_cls'))

    @ddt.file_data(TestData_dir + "cls_manage_wxj.yaml")
    def test_cls_manage(self,**kwargs):
        res=self.run.cls_manage(kwargs.get('cls_num'),kwargs.get('direction'),kwargs.get('teacher'))
        print(res)
        self.assertEqual(res,kwargs.get('except'))

    # def test_z(self):
    #     self.run.closeBrowser()

if __name__ == '__main__':
    unittest.main()